//
//  QPayMoreOrderView.m
//  QoilPublic
//
//  Created by 杨凯 on 16/11/21.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QPayMoreOrderView.h"
#import "QPayMoreOrderCell.h"
@interface QPayMoreOrderView()<UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet UILabel *orderDesLabel;

@property (weak, nonatomic) IBOutlet UITableView *tableView;

@property (weak, nonatomic) IBOutlet UIView *bacView;

@end

@implementation QPayMoreOrderView


- (void)awakeFromNib{
    [super awakeFromNib];

    [self createTableView];
    
}

- (void)setAllMoney:(NSString *)allMoney{

    _allMoney = allMoney;
}

- (void)setData:(NSArray *)data{
    _data = data;
    _orderDesLabel.text = [NSString stringWithFormat:@"您有%ld笔未支付的加满订单,订单详情如下",(unsigned long)_data.count];

    [_tableView reloadData];
}

- (void)createTableView{

    _bacView.layer.cornerRadius = 4.0;
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

    [_tableView registerNib:[UINib nibWithNibName:@"QPayMoreOrderCell" bundle:nil] forCellReuseIdentifier:@"QPayMoreOrderCell"];
}

#pragma mark --- tableViewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    QPayMoreOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"QPayMoreOrderCell" forIndexPath:indexPath];
    
    if(_data.count){
    }
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 130;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return 0.01;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{

    return 0.01;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return [[UIView alloc]init];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return [[UIView alloc] init];
}

- (IBAction)cancelAction:(id)sender {
    
    CLog(@"取消");
    if(self.blockA){
        self.blockA(0);
    }
}

- (IBAction)agreeAction:(id)sender {
    CLog(@"确定支付");
    if(self.blockB){
        self.blockB(1);
    }
}



@end
